package 循环语句作业;

public class homework5 {

    public static void main(String[] args) {
    System.out.println("前20个斐波那契数字为: ");
    int num1 = 1, num2 = 1;
    System.out.print(num1 + " " + num2 + " ");
    for (int i = 3; i <= 20; i++) {
        int nextNum = num1 + num2;
        System.out.print(nextNum + " ");
        num1 = num2;
        num2 = nextNum;
    }
    System.out.println();
}
}
